// 约定参数错误都是1

// 请求级的中间件  --- 放在路由处理函数的前面
exports.testLogin = (req , res , next) => {
    console.log(req.body)
    const {username , password} = req.body ;
    if(!username || !password) {
        // return res.send({code : 0 , msg : '参数错误'}) ;
        return next(1);
    }
    next()
}



// exports.testReg = (req , res , next) => {
//     console.log(req.body)
//     const {username , password} = req.body ;
//     if(!username || !password) {
//         return res.send({code : 0 , msg : '参数错误'}) ;
//     }
//     next()
// }


exports.testRpwd = (req , res , next) => {
    console.log(req.body)
    const {username , password , newPwd} = req.body ;
    if(!username || !password || !newPwd) {
        // return res.send({code : 0 , msg : '参数错误'}) ;
        return next(1) ;
    }
    next()
}

